class Solution {
public:
    int minOperations(vector<int>& nums, int k) {
        priority_queue<long long,vector<long long>,greater<long long>> q;
        for(int i=0;i<nums.size();i++)
            q.push(nums[i]);

        int ret=0;
        while(q.top()<k)
        {
            long long x=q.top();
            q.pop();
            long long y=q.top();
            q.pop();
            q.push(min(x,y)*2+max(x,y));
            ret++;
        }
        return ret;
    }
};
